#include "Template.h"


void AbstractClass::TemplateMethod()
{
	cout << "algorithm begin" << endl;
	PrimitiveOperation1();
	PrimitiveOperation2();
	cout << "algorithm end" << endl;
}

void ConcreteClassA::PrimitiveOperation1()
{
	cout << "Concrete Operation 1 of A" << endl;
}

void ConcreteClassA::PrimitiveOperation2()
{
	cout << "Concrete Operation 2 of A" << endl;
}

void ConcreteClassB::PrimitiveOperation1()
{
	cout << "Concrete Operation 1 of B" << endl;
}

void ConcreteClassB::PrimitiveOperation2()
{
	cout << "Concrete Operation 2 of B" << endl;
}

int main()
{
	AbstractClass *A = new ConcreteClassA;

	A->TemplateMethod();

	AbstractClass *B = new ConcreteClassB;

	B->TemplateMethod();

	delete A;
	delete B;
}
